window.onload = function() {
    let username = document.getElementById("username")
    let password = document.getElementById("password")
    console.log(username.value)

    username.addEventListener("input", (e) => {
        console.log("正在输入", e.target.value)
    })

    let name = username.value

    let btn = document.querySelector("button")
    btn.addEventListener("click", (e) => {
        e.preventDefault()
        let key = password.value

        // fetch("http://172.18.222.185:8080/login ",{method:"POST"})
        // .then(()=>console.log("POST请求成功了"))

        fetch("http://172.0.0.1:8080/login" + "?username=" + name + "&key=" + key, { method: "GET" })
            .then(() => console.log("GET请求成功了"))
        location.href = "http://172.19.14.2:8080/login";
    })
    let btn2 = document.getElementById("dl")
    btn2.addEventListener("click", (e) => {
            e.preventDefault()
            let key = password.value

            fetch("http://172.19.14.2:8080/login" + "?username=" + name + "&key=" + key, { method: "GET" })
                .then(() => console.log("GET请求成功了（不跳转版本）"))
        })
        // 172.18.222.185我自己的
}